package o;

import androidx.annotation.Nullable;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import java.util.ArrayList;
import java.util.List;

public class cmn {
    private static volatile cmn ˊ = null;
    private static final Object ॱ = new byte[0];
    private bnh ˋ;

    public static cmn ˎ() {
        if (ˊ == null) {
            synchronized (ॱ) {
                if (ˊ == null) {
                    ˊ = new cmn();
                }
            }
        }
        return ˊ;
    }

    private cmn() {
        fhq ˏ = fho.ˏ();
        if (ˏ != null) {
            fhz ˋ = ˏ.ˋ("DownloadEngine");
            if (ˋ != null) {
                this.ˋ = (bnh) ˋ.ॱ(bnh.class);
            }
        }
    }

    public SessionDownloadTask ˏ(String str) {
        return ॱ(str);
    }

    @Nullable
    private SessionDownloadTask ॱ(String str) {
        if (dof.ˋ(str)) {
            return null;
        }
        List<SessionDownloadTask> ˋ = ˋ(str);
        if (!CollectCheck.isEmpty(ˋ)) {
            for (SessionDownloadTask sessionDownloadTask : ˋ) {
                int ˌ = sessionDownloadTask.ˌ();
                if (ˌ != 9 && ˌ != 10) {
                    return sessionDownloadTask;
                }
            }
        }
        return null;
    }

    @Nullable
    private List<SessionDownloadTask> ˋ(String str) {
        if (dof.ˋ(str)) {
            return null;
        }
        List<SessionDownloadTask> arrayList = new ArrayList();
        for (SessionDownloadTask sessionDownloadTask : this.ˋ.ॱ()) {
            if (str.equals(sessionDownloadTask.ˊˊ())) {
                arrayList.add(sessionDownloadTask);
            }
        }
        return arrayList;
    }
}
